package com.fly.security.service

import com.fly.security.entity.User
import com.fly.security.mapper.UserMapper
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.reactive.asFlow
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service

/**
 * @author  fly
 * @date  2021/7/29 18:04
 * @version 1.0
 */
@Service
class UserService {

    @Autowired
    private lateinit var userMapper: UserMapper

    suspend fun findAll() = userMapper.findAll().asFlow()

    suspend fun saveUser(user: User) = userMapper.save(user).asFlow()
}